import 'package:dio/dio.dart';

class HttpClient {
  static const String BASEURL = 'https://miapp.itying.com/';
  static final options = BaseOptions(
    baseUrl: BASEURL,
    connectTimeout: const Duration(seconds: 5),
    receiveTimeout: const Duration(seconds: 3),
  );

  static final _dio = Dio(options);

  static Future get(String path) async {
    try {
      var rsp = await _dio.get(path);

      return rsp;
    } catch (e) {
      print('请求出错  : ${e}');
      return null;
    }
  }

  static String imageUrl(String imgPath) {
    String url = '${BASEURL}${imgPath}';

    return url.replaceAll('\\', '/');
  }
}
